﻿namespace WebPacker.Tests.Filters
{
	using System;
	using System.IO;
	using NUnit.Framework;
	using WebPacker.Filters;

	[TestFixture]
	public abstract class FilterBaseTest
	{
		[Test]
		public void ApplyNullTest()
		{
			Assert.Throws<ArgumentNullException>(() => GetFilter().Apply(null));
		}

		[Test]
		public void SimpleApplyTest()
		{
			var content = File.ReadAllText(GetSampleFile());
			var result = GetFilter().Apply(content);
			Assert.IsNotNull(result);
		}

		[Test]
		public void ApplyToCombinedNullTest()
		{
			Assert.Throws<ArgumentNullException>(() => GetFilter().ApplyToCombined(null));
		}

		[Test]
		public void SimpleApplyToCombinedTest()
		{
			var content = File.ReadAllText(GetSampleFile());
			var result = GetFilter().ApplyToCombined(content);
			Assert.IsNotNull(result);
		}

		protected abstract IFilter GetFilter();

		protected abstract string GetSampleFile();
	}
}
